package com.aishua.aishuawallet.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by aishua on 2018/8/1.
 */

public class CacheUtils {
    private static  String spname = "wallet";

    public static void putBoolean(Context context, String key, boolean value) {
        SharedPreferences sp = context.getSharedPreferences(spname, Context.MODE_PRIVATE);
        sp.edit().putBoolean(key, value).commit();
    }

    public static boolean getBoolean(Context context, String key) {
        SharedPreferences sp = context.getSharedPreferences(spname, Context.MODE_PRIVATE);
        return sp.getBoolean(key, false);
    }

    public static void putLoginname(Context context, String key, String value) {
        SharedPreferences sp = context.getSharedPreferences(spname, Context.MODE_PRIVATE);
        sp.edit().putString(key, value).commit();
    }

    public static String getLoginname(Context context, String key) {
        SharedPreferences sp = context.getSharedPreferences(spname, Context.MODE_PRIVATE);
        return sp.getString(key,null);
    }

    public static void putLoginpw(Context context, String key, String value) {

        SharedPreferences sp = context.getSharedPreferences(spname, Context.MODE_PRIVATE);
        sp.edit().putString(key, value).commit();
    }

    public static String getLogipw(Context context, String key) {

        SharedPreferences sp = context.getSharedPreferences(spname, Context.MODE_PRIVATE);
        return sp.getString(key, null);
    }

    public static void putlanguage(Context context, String key, String value) {

        SharedPreferences sp = context.getSharedPreferences(spname, Context.MODE_PRIVATE);
        sp.edit().putString(key, value).commit();
    }

    public static String getlanguage(Context context, String key) {

        SharedPreferences sp = context.getSharedPreferences(spname, Context.MODE_PRIVATE);
        return sp.getString(key, null);
    }
}
